package com.example.lambda.rest;

import com.example.lambda.entity.TestBody;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Administrator
 * @date 2021/1/20 22:27
 * @desc
 */
@RestController
public class TestController {

    @GetMapping("/test1")
    public String test1(String param){
        System.out.println(param);
        return param;
    }

    @PostMapping("/test2")
    public Map<String, Object> test2(@RequestBody TestBody body){
        System.out.println(body.toString());
        return new HashMap<String, Object>(){{
            put("status", "ok");
        }};
    }
}
